import cv2 as cv

img_path = r"E:\studylife\detectflaws\code\python\FFT\4_17_mp4\nodt4,Hz(0.16)pha_gray,r(0,480)c(0, 640)m(160,400).jpg"
save_path = r"E:\studylife\detectflaws\code\python\FFT\4_17_mp4\nodt4,Hz(0.16)pha_gray,r(0,480)c(0, 640)m(160,400)"  # 保存地址

img = cv.imread(img_path)
# 使用rgb图显示结果  此方法为使用opencv中的cv.applyColorMap()函数实现
# 伪彩色图参数有：cv.COLORMAP_JET  cv.COLORMAP_AUTUMN  cv.COLORMAP_BONE   WINTER   RAINBOW   OCEAN
im_color1 = cv.applyColorMap(img, cv.COLORMAP_JET)
im_color2 = cv.applyColorMap(img, cv.COLORMAP_AUTUMN)
im_color3 = cv.applyColorMap(img, cv.COLORMAP_BONE)
im_color4 = cv.applyColorMap(img, cv.COLORMAP_WINTER)
im_color5 = cv.applyColorMap(img, cv.COLORMAP_RAINBOW)
im_color6 = cv.applyColorMap(img, cv.COLORMAP_OCEAN)

cv.imwrite(f'{save_path}/JET.jpg', im_color1)
cv.imwrite(f'{save_path}/AUTUMN.jpg', im_color2)
cv.imwrite(f'{save_path}/BONE.jpg', im_color3)
cv.imwrite(f'{save_path}/WINTER.jpg', im_color4)
cv.imwrite(f'{save_path}/RAINBOW.jpg', im_color5)
cv.imwrite(f'{save_path}/OCEAN.jpg', im_color6)


